<%! func Nav(w http.ResponseWriter,r *http.Request, current string) error %>
<%% import "net/http" %%>
<%% import "github.com/infinitbyte/framework/core/api" %%>

<nav class="tm-navbar uk-navbar uk-navbar-attached">
  <div class="uk-container uk-container-center">
    <%
    logoUrl:="/admin/"
    if len(navs)>0 {
      logoUrl=navs[0].url
    }
    %>
    <a class="uk-navbar-brand uk-hidden-small" href="<%= logoUrl %>"><img class="uk-margin uk-margin-remove" src="/static/assets/img/logo.svg" width="90" height="30" title="GOPA" alt="GOPA"></a>

    <ul class="uk-navbar-nav uk-hidden-small">

      <% if len(navs)>0 {
      for _,obj:=range navs{
      %>
      <li <%== NavCurrent(current,obj.name) %> ><a href="<%= obj.url %>"><%= obj.displayName %></a></li>
      <%
      }
      }
      %>
    </ul>

    <div class="uk-navbar-flip">

      <a href="#search-modal" data-uk-modal="" class="uk-navbar-toggle uk-navbar-toggle-alt uk-visible-small"></a>
      <div id="search-modal" class="uk-modal">
        <div class="uk-modal-dialog">
          <a class="uk-modal-close uk-close"></a>
          <form  action="/">
            <input name="q" type="text" placeholder="Please type to search" class="uk-form-large uk-width-1-1">
          </form>
        </div>
      </div>

      <ul class="uk-navbar-nav uk-hidden-small">
        <li>
          <div class="uk-form-icon">
              <form  action="/">
                <input name="q" type="text" placeholder="Please type to search" class="uk-form-large uk-width-1-1">
              </form>
          </div>
        </li>
        <li class="uk-parent" data-uk-dropdown="" aria-haspopup="true" aria-expanded="false">
          <a href=""><i class="uk-icon-plus-square"></i>&nbsp;Menu</a>

          <div class="uk-dropdown uk-dropdown-navbar uk-dropdown-bottom" aria-hidden="true" tabindex="" style="top: 40px; left: -119px;">
            <ul class="uk-nav uk-nav-navbar">
              <% if api.IsAuthEnable() && api.CheckPermission(w,r,api.PERMISSION_ADMIN_MINIMAL){
              user,_:=api.GetLoginInfo(w,r)
              %>
                <li class="uk-nav-divider"></li>
                <li><a href="/auth/logout/"><i class="uk-icon-power-off"></i> Logout(<%= user %>)</a></li>
              <% } %>
            </ul>
          </div>

        </li>
      </ul>

    </div>

    <% OffCanvas(w,current) %>
    <a href="#tm-offcanvas" class="uk-navbar-toggle uk-visible-small" data-uk-offcanvas=""></a>

    <div class="uk-navbar-brand uk-navbar-center uk-visible-small"><img src="/static/assets/img/logo.svg" width="90" height="30" title="GOPA" alt="GOPA"></div>

  </div>
</nav>

<div style="height: 15px;clear: both"></div>


